	<!DOCTYPE html>
	<html>


	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0,maximum-scale=1.0">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="format-detection" content="telephone=no" />
		<meta http-equiv="pragma" content="no-cache" />
		<meta http-equiv="Cache-Control" content="no-cache, must-revalidate" />
		<meta http-equiv="expires" content="0" />
		<title>代理中心</title>
		<link rel="stylesheet" href="/static/h5Static/css/base.css">
		<link rel="stylesheet" href="/static/h5Static/css/style.css?t=000018">
		<link rel="stylesheet" href="/static/h5Static/css/dialog.css">
		<link rel="stylesheet" href="/static/h5Static/css/page-num.css">
		<link rel="stylesheet" href="/static/h5Static/css/inviteCode.css" />
		<link rel="stylesheet" href="/static/h5Static/css/manager.css?t=0000002" />
		<script src="/static/h5Static/js/self_adaption.js?t=00001"></script>
		<script src="/static/h5Static/js/jquery-1.10.1.min.js"></script>
	</head>

	<link type="text/css" rel="stylesheet" href="/static/h5Static/js/jedate/skin/jedate.css">

	<body class="bgcolor rebate-detail-week" id="myAgent">
		<div id="warper">
			<div class="date-shadow">
				<div class="date-ctrl">
					<div>
						<input type="text" id="start" class="datainp" readonly placeholder="请选择开始时间" />
						<input type="text" id="end" class="datainp" readonly placeholder="请选择结束时间" />
						<button id="dateSearch">搜索</button>
					</div>
					<span class="date-close"></span>
				</div>
			</div>
			<div class="search-shadow">
				<div class="search-ctrl">
					<img class="search-close" src="/static/h5Static/img/back-w.png" />
					<input id="playerId" type="tel" placeholder="请输入ID" />
					<button id="searchBtn">搜索</button>
				</div>
			</div>
			<header class="header-center">
				<a class="back" href="/h5/main.html"></a>
				我的玩家
				<a class="search-btn" href="javascript:;"></a>
				<a class="date-search" href="javascript:;"></a>
			</header>
			<div class="content">
				<div class="count">
					<p class="l">总人数：<span id="totalNum">0</span></p>
					<a class="r no-bind-other" href="/h5/player/scanQrcodeBindOther.html">点击这里，查看绑定失败玩家</a>
				</div>

				<div style="overflow: auto;">
					<table>
						<thead>
							<tr>
								<th>玩家</th>
								<th>绑定时间</th>
								<!--<th>剩余金币</th>
								<th>耗金币数</th>-->
								<th>返利金额</th>
								<th>状态</th>
								<!--<th style="width: 7rem;">操作</th>-->
							</tr>
						</thead>
						<tbody>
							<!--<tr>
								<td>一个名字<br>ID:22342234</td>
								<td>2017-01-02</td>
								<td>999</td>
								<td class="colorff7923">999.00</td>
								<td>
									<a class="detail" href="/h5/send/sendDiamond.html">赠金币</a>
								</td>
							</tr>
							<tr>
								<td>一个名字<br>ID:22342234</td>
								<td>2017-01-02</td>
								<td>999</td>
								<td class="colorff7923">999.00</td>
								<td>
									<a class="detail" href="/h5/send/sendDiamond.html">赠金币</a>
								</td>
							</tr>-->
						</tbody>
					</table>
				</div>
			</div>
			<div class="page-ctrl">
				<div class="page-num">
					<a class="prev_page">上一页</a>
					<a class="next_page">下一页</a>
					<a class="end_page">末页</a>
				</div>
			</div>
		</div>
	</body>
	<script src="/static/h5Static/js/dialog.js"></script>
	<script src="/static/h5Static/js/jedate/jquery.jedate.js"></script>

	<script>
		$(document).ready(function() {
			var pageSize = 10;
			/*查询*/
			DrawTable(1);
			$("#start").jeDate({
				format: "YYYY-MM-DD",
				isinitVal: false,
				festival: false,
				maxDate: $.nowDate(0),
				ishmsVal: false
			})
			$("#end").jeDate({
				format: "YYYY-MM-DD",
				isinitVal: false,
				festival: false,
				maxDate: $.nowDate(0),
				ishmsVal: false
			})
			/*点击分页*/
			$('.page-ctrl').delegate('a[href=#page-num]', 'click', function() {
				var nowPage = $(this).attr('page-num');
				DrawTable(nowPage);
			});

			/*时间搜索*/
			$('.date-search').click(function() {
				$('.search-shadow').hide();
				$('.date-shadow').show();
			});
			$('.date-close').click(function() {
				$('.date-shadow').hide();
			});
			$('#dateSearch').click(function() {
				$('#playerId').val('');
				DrawTable(1);
			});
			/*代理ID搜索*/
			$('.search-btn').click(function() {
				$('.date-shadow').hide();
				$('.search-shadow').show();
			});
			$('.search-close').click(function() {
				$('.search-shadow').hide();
			});
			$('#searchBtn').click(function() {
				$('#start').val('');
				$('#end').val('');
				DrawTable(1);
			});

			function DrawTable(n) {
				var start = $('#start').val();
				var end = $('#end').val();
				var playerId = $('#playerId').val();
				if(start > end) {
					dialogbox({
						msg: '开始时间不能大于结束时间'
					});
					return;
				}
				if(!/^[0-9]*$/.test(playerId)) {
					dialogbox({
						msg: '请输入正确的ID'
					});
					return;
				}
				$.ajax({
					url: '/gameCard/myPlayers.json?t=' + Math.random(),
					type: 'get',
					dataType: 'JSON',
					data: {
						pageNum: n,
						pageSize: pageSize,
						start: start,
						end: end,
						playerId: playerId
					},
					success: function(response) {
						if(response.code == 0) {
							$('.date-shadow').hide();
							$('.search-shadow').hide();
							$('#totalNum').text(response.data.total);
							var list = response.data.list;
							if(list.length != 0) {
								var str = '';
								for(var i = 0; i < list.length; i++) {
									var sendCard = '';
									var sumIncome = list[i].sumIncome.toFixed(3);
									var status = (list[i].playerId == "无" || list[i].playerId == "0") ? "未登入游戏" : "正常";
									if(list[i].sendCard == 1) {
										sendCard = '<a class="detail" href="/h5/player/consume_detail.html?playerId=' + list[i].playerId + '">详情</a>';
									}
									str += '<tr>' +
										'<td>' + list[i].nickName + '<br>ID:' + list[i].playerId + '</td>' +
										'<td>' + format(list[i].createTime * 1000, 'yyyy-MM-dd') + '</td>' +
										/*'<td>' + list[i].fkNumber + '</td>' + '<td>' + Math.round(list[i].sumPrice*100) + '</td>' + */
										'<td class="colorff7923">' + sumIncome.substring(0, sumIncome.lastIndexOf('.') + 3) + '</td>' +
										'<td>' + status + '</td>' +
										/*'<td>' + sendCard + '</td>' +*/
										'</tr>';
								}
								$('tbody').html(str);
								pageCtrlFirstEnd({
									total: response.data.total,
									page: response.data.pageNum,
									pageSize: pageSize
								});

							} else {
								pageCtrlFirstEnd({
									total: response.data.total,
									page: response.data.pageNum,
									pageSize: pageSize
								});
								$('tbody').html('<tr><td colspan="4">暂无数据</td></tr>');
							}
						} else {
							dialogbox({
								msg: response.msg
							});
						}
					}
				});
			}
		});
	</script>

	</html>